1. Field of the Invention
The present invention relates to the simulation of an electric circuit and more specifically to methods for determining time variations of the voltages and of the currents of an electric circuit according to external stimuli. The present invention particularly applies to electric circuits comprising analog components such as transistors, resistors, capacitors, diodes, and inductances.
2. Discussion of the Related Art
FIG. 1 is an example of a simple circuit comprising a diode d and a variable resistor r in series between an upper power supply terminal vdd and a lower power supply terminal gnd. Value R of resistor r is controlled by a control signal C. In this example, it is desired to determine the voltage at node N between the anode of diode d and resistor r as well as the current flowing through resistor r and diode d.
FIG. 2 is a graph showing the variations of the current in each component according to voltage VN at node N. Curve Cd shows the variations of current id flowing through diode d according to voltage VN. Straight line Cr shows the variations of current ir flowing through resistor r according to voltage VN for a given voltage VC.
It is possible to determine, based on this diagram, the current flowing through resistor r and diode d as well as voltage VN at node N. Indeed, according to the mesh equation, current id flowing through diode d is equal to current ir flowing through resistor r. Crosspoint P0 of straight line Cr and of curve Cd corresponds to a current i0 and to a voltage VN0 for which the current in diode d is equal to the current in resistor r.
The above-described circuit example is extremely simple and the mathematical models of operation of diode d and of resistor r are also very simple. Generally, in the field of electric circuit simulation, the analyzed circuits may comprise several hundreds of components and the mathematical models of the operation of each component may comprise several tens of equations. Conversely to the previous example where the determination of current i0 and of voltage VN0 consists of solving a simple equation, the determination of the voltages and of the currents of a more complex circuit requires solving a large number of generally non-linear differential equations. In practice, the determination of the voltages and of the currents of an electric circuit is performed according to an iterative method described hereafter based on the simple example illustrated in FIG. 1.
FIG. 3 is a graph similar to the graph of FIG. 2. Straight lines Cr0 and Cr1 show the variations of current ir flowing through resistor r according to voltage VN for two different values of voltage VC, respectively VC0 and VC1, VC1 being greater than VC0. Curve Cd shows, as previously, the variations of current id in diode d according to voltage VN.
At a time t0, voltage VC is equal to VC0. Voltage VN and currents id and ir are considered as known and as being equal respectively to VN0, i0 and i0, voltage VN0 and current i0corresponding to crosspoint P0 of straight line Cr0 and of curve Cd.
At a time t1 following t0, voltage VC switches and becomes equal to VC1. The determination of voltage VN and of currents id and ir is then performed according to the following method.
The direction of the variation of voltage VN is not known a priori, and the assumption is made that voltage VN at time t1 is unchanged and equal to VN0. Current id at time t1 is then calculated based on the model of diode d. Current id is equal to current i0 since the voltages across the diode have not changed. Still in the assumption that voltage VN is unchanged at time t1, current ir at time t1 is calculated based on the model of resistor r for a control voltage VC equal to VC1. Current ir is equal to current ir,a corresponding to point Pr,a of straight line Cr1 for a voltage VN equal to VN0.
The mesh equation is then verified at node N. In other words, it is checked whether current id is equal to current ir. In this example, currents i0 and ir1,a are obviously different, as appears from FIG. 3.
The derivative of current id according to voltage VN is then calculated for a voltage VN equal to VN0. The equation of tangent Td,a to curve Cd at point P0 can then be defined. Similarly, the derivative of current ir according to voltage VN is calculated for a voltage equal to VN0. Then, the equation of tangent Tr,a to curve Cr1 at point Pr,a is defined. Tangent Tr,a is in fact confounded with straight line Cr1.
Tangents Td,a and Tr,a previously calculated indicate the direction of the variation of currents ir and id when voltage VN varies around VN0. Tangent Td,a is a simplified representation of curve Cd which enables making estimations of the value of the current according to the direction of the variation of voltage VN. Crosspoint PC, a of the two tangents Td,a and Tr,a is then identified. Crosspoint PC,a enables identifying a voltage VN equal to VNC,a for which currents ir and idare likely to be identical. A new assumption about the value of voltage VN at time t1 is then made by taking it equal to voltage VNC,a.
The currents id and ir corresponding to voltage VNC,a are calculated. Current ir is equal to current iC,a corresponding to point PC,a. Current id is equal to current id,b corresponding to point Pd,b of curve Cd for a voltage VN equal to VNC,a.
The mesh equation is then verified again at node N. Currents iC,a and id,b are not strictly equal but their difference is small. If the desired accuracy is low, voltage VN at time t1 is considered as equal to voltage VNC,a and the current flowing through diode d and resistor r is considered as equal to iC,a. In the opposite case, the search for voltage VN and the current flowing through diode d and resistor r is refined by calculating the equations of tangents Td,b and Tr,b respectively at points Pd,b and PC,a to make a new assumption as to voltage VN. The currents for this new voltage VN equal to VNC,b are then calculated and the mesh equation is verified again. The search is continued until converging towards sufficiently close currents.
Generally, a simulation of a circuit such as that in FIG. 1 aims at determining the voltages and the currents of a circuit receiving stimuli. The initial state of the circuit is first determined from the initial values of the stimuli at an initial simulation time t0. For this purpose, default voltage values are given to each circuit node, after which a first series of “convergence” iterations are performed according to a method identical to that described hereabove, until initial voltages and currents entering or coming out of each of the circuit components which comply with the mesh equation for these initial voltages are obtained. The circuit state at a time t1 following time t0 is then determined, the time elapsed between time t0 and time t1 corresponding to the simulation “step”. The circuit state at time t1 is determined by a second series of iterations such as that described hereabove in relation with FIG. 3, with the assumption that the voltages are unchanged. The circuit state at following times t2 to tn, where n is a positive integer, is then determined. The determination of the voltages at a given time tj, j ranging between 2 and n, consists of defining “start” voltages prior to the implementation of a series of convergence iterations. The definition of the “start” voltages takes into account the voltages calculated at the preceding times. An extrapolation may for example be performed by taking into account the voltages calculated for the last two times.
The use of conventional simulation methods such as that described hereabove results in long simulation durations. Such durations become prohibitive when more and more complex circuits are desired to be simulated by using more and more accurate and more and more complex component models. The number of simulation steps then has to be reduced.